﻿using System;
using Microsoft.VisualStudio.Modeling;

namespace Rosieks.VisualStudio.Web.Flow
{
    public partial class TransitionSerializer
    {
        private Moniker CustomMonikerizeReference(SerializationContext serializationContext, ModelElement sourceElement, Guid domainClassId, string monikerString, Store store)
        {
            return this.DefaultMonikerizeReference(serializationContext, sourceElement, domainClassId, "//" + monikerString, store);
        }

        private string CustomSerializeReference(SerializationContext serializationContext, ModelElement sourceElement, ModelElement targetElement)
        {
            State state = targetElement as State;
            if (state == null)
            {
                throw new ArgumentException("Target element is not a state", "targetElement");
            }

            return state.Name;
        }
    }
}
